You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
1.4 KiB

2 months ago
import React from "react";
import { getFloorBySlug } from "../../../../lib/data";
import { ProductGrid } from "../../../../components/ProductGrid";
export const revalidate = 300;
export default function ChannelPage({ params }: { params: { locale: string; slug: string } }) {
const floor = getFloorBySlug(params.slug, params.locale);
if (!floor) {
return (
<div className="mx-auto max-w-screen-2xl px-4 py-12">
<h1 className="text-2xl font-semibold">Channel Not Found</h1>
<a className="mt-6 inline-block text-blue-600" href={`/${params.locale}`}>Back</a>
</div>
);
}
return (
<div className="mx-auto max-w-screen-2xl px-4 py-8 space-y-8">
<div className="flex items-center justify-between">
<h1 className="text-2xl font-semibold">{floor.title}</h1>
<a href={`/${params.locale}`} className="text-sm text-gray-600 hover:text-gray-900">{params.locale === 'en' ? 'Home' : '返回首页'}</a>
</div>
1 month ago
{floor.hero?.image && (
<a href={floor.hero.href ?? `/${params.locale}`} className="block overflow-hidden rounded-xl">
<img
src={floor.hero.image}
alt={floor.hero.title ?? floor.title}
className="aspect-[16/6] w-full object-cover"
/>
2 months ago
</a>
)}
<ProductGrid items={floor.products} basePath={`/${params.locale}`} />
</div>
);
}